package 笔试记录.M9day1;


import java.util.Scanner;

public class Main1 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        char[] arr = s.toCharArray();
        int left = -1;
        int right = 0;
        while(right < arr.length && left <= right) {
            if(left < 0 || arr[left] != arr[right]){
                arr[++left] = arr[right];
                right++;
            }else{
                while(arr[left] == arr[right]){
                    right++;
                }
                if(right - left > 2){
                    left--;
                }else{
                    left = right;
                }
            }
        }
        String res = s.toString();
        System.out.println(s.substring(0,left));
    }
}
//222BCC111CB